package com.example.myDesignPatterns.结构型模式.装饰者模式Decorator;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

//快餐接口
@Data
//@AllArgsConstructor
//@NoArgsConstructor
public abstract class FastFood {
    private float price;//==10  1
    private String desc;//炒饭    鸡蛋

    //无参构造
    public FastFood() {
    }

    //有参构造
    public FastFood(float price, String desc) {
        this.price = price;
        this.desc = desc;
    }

    abstract float calculateCost() ;

    public float getPrice() {
        return price;
    }

    public void setPrice(float price) {
        this.price = price;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }
}

//炒饭
class FriedRice extends FastFood {
    public FriedRice() {
        super(10, "炒饭");
    }//构造函数  创建方法

    public float calculateCost() {
        return getPrice();
    }
}
//炒面
class FriedNoodles extends FastFood {
    public FriedNoodles() {
        super(12, "炒面");
    }
    public float calculateCost() {
        return getPrice();
    }
}
